<head>
	

</head>
<div class="panel-body">
	<div class="table-responsive">
		<div class="dataTables_wrapper form-inline" id="dataTables-example_wrapper" role="grid">
			<div class="row" style="padding-bottom: 15px">
				<div class="col-sm-9">
					<input type="text" placeholder="开始时间" id="beginTime" >至<input type="text" placeholder="结束时间" id="endTime" >
					<a class="btn btn-serch" onclick="Search()">查询</a>

				</div>
				<div class="col-sm-3">
					<!--<div class="dataTables_filter" id="dataTables-example_filter" style="float: right">
                        <a class="btn btn-serch" onclick="Toexcel()">导 出 </a>
                    </div>-->
				</div>
			</div>
			<h4>一、电子沙盘登陆情况</h4>
			<table class="table table-striped table-bordered table-hover dataTable no-footer" id="dataTables-example" aria-describedby="dataTables-example_info">
				<thead>
					<tr role="row" id="useagetitle">
					</tr>
				</thead>
				<tbody id="useagelist">

				</tbody>
			</table>
			<h4>二、酒店市场拓展</h4>
			<table class="table table-striped table-bordered table-hover dataTable no-footer" id="dataTables-example" aria-describedby="dataTables-example_info">
				<thead>
					<tr role="row" id="hoteltitle">
					</tr>
				</thead>
				<tbody id="hotellist">

				</tbody>
			</table>
			<h4>三、新增商铺情况</h4>
			<table class="table table-striped table-bordered table-hover dataTable no-footer" id="dataTables-example" aria-describedby="dataTables-example_info">
				<thead>
					<tr role="row" id="shoptitle">
					</tr>
				</thead>
				<tbody id="shoplist">

				</tbody>
			</table>
			<h4>四、楼宇市场拓展</h4>
			<table class="table table-striped table-bordered table-hover dataTable no-footer" id="dataTables-example" aria-describedby="dataTables-example_info">
				<thead>
					<tr role="row" id="buildtitle">
					</tr>
				</thead>
				<tbody id="buildlist">

				</tbody>
			</table>
			<h4>五、商客经理使用明细</h4>
			<table class="table table-striped table-bordered table-hover dataTable no-footer" id="dataTables-example" aria-describedby="dataTables-example_info">
				<thead>
					<tr role="row" id="managertitle">
					</tr>
				</thead>
				<tbody id="managerlist">

				</tbody>
			</table>
		</div>
	</div>
</div>
<script>
	$(function() {
		$("#beginTime").datetimepicker({
			format: 'yyyy-mm-dd',
			weekStart:1,
			language:'zh-CN',
			minView:2
		});
		$("#endTime").datetimepicker({
			format: 'yyyy-mm-dd',
			weekStart:1,
			language:'zh-CN',
			minView:2
		});
	})
	//请求列表
	function setTable() {
		$.ajax({
			type: 'get', //请求的类型
			url: GLOBAL.URL + "/customer/queryUseAge", //请求的地址
			dataType: "json", //返会值的类型
			data: {
				"startTime": $("#beginTime").val(),
				"endTime": $("#endTime").val()
			},
			async: false,
			xhrFields: {
				withCredentials: true
			},
			crossDomain: true,
			success: function(data, textStatus) {
				if(data.code == 0) {
					//使用情况
					var useagetitle = "";
					useagetitle += '<th tabindex="0" class="sorting" aria-controls="dataTables-example" style="text-align: center;width: 5%;" rowspan="1" colspan="1">区县</th>';
					useagetitle += '<th tabindex="0" class="sorting" aria-controls="dataTables-example" style="text-align: center;width: 5%;" rowspan="1" colspan="1">总工号数</th>';
					useagetitle += '<th tabindex="0" class="sorting" aria-controls="dataTables-example" style="text-align: center;width: 5%;" rowspan="1" colspan="1">使用数</th>';
					useagetitle += '<th tabindex="0" class="sorting" aria-controls="dataTables-example" style="text-align: center;width: 5%;" rowspan="1" colspan="1">使用率</th>';
					var useagedata = "";
					for(var k = 0; k < data.useAge.length; k++) {
						data.useAge[k].countryName = data.useAge[k].countryName == null ? "" : data.useAge[k].countryName;
						data.useAge[k].managerCount = data.useAge[k].managerCount == null ? "" : data.useAge[k].managerCount;
						data.useAge[k].useManagerCount = data.useAge[k].useManagerCount == null ? "" : data.useAge[k].useManagerCount;
						data.useAge[k].percent = data.useAge[k].percent == null ? "" : data.useAge[k].percent;
						useagedata += '<tr class="gradeA odd"><td style="text-align: center">' + data.useAge[k].countryName + '</td>';
						useagedata += '<td style="text-align: center">' + data.useAge[k].managerCount + '</td>';
						useagedata += '<td style="text-align: center">' + data.useAge[k].useManagerCount + '</td>';
						useagedata += '<td style="text-align: center">' + data.useAge[k].percent + '</td>';
						useagedata += '</tr>';
					}
					$("#useagetitle").html(useagetitle);
					$("#useagelist").html(useagedata);
					//酒店市场拓展
					var hoteltitle = "";
					hoteltitle += '<th tabindex="0" class="sorting" aria-controls="dataTables-example" style="text-align: center;width: 5%;" rowspan="1" colspan="1">区县</th>';
					hoteltitle += '<th tabindex="0" class="sorting" aria-controls="dataTables-example" style="text-align: center;width: 5%;" rowspan="1" colspan="1">酒店数</th>';
					hoteltitle += '<th tabindex="0" class="sorting" aria-controls="dataTables-example" style="text-align: center;width: 5%;" rowspan="1" colspan="1">门头照</th>';
					hoteltitle += '<th tabindex="0" class="sorting" aria-controls="dataTables-example" style="text-align: center;width: 5%;" rowspan="1" colspan="1">资源已覆盖酒店数</th>';
					hoteltitle += '<th tabindex="0" class="sorting" aria-controls="dataTables-example" style="text-align: center;width: 5%;" rowspan="1" colspan="1">已签约酒店数</th>';
					hoteltitle += '<th tabindex="0" class="sorting" aria-controls="dataTables-example" style="text-align: center;width: 5%;" rowspan="1" colspan="1">房间总数</th>';
					hoteltitle += '<th tabindex="0" class="sorting" aria-controls="dataTables-example" style="text-align: center;width: 5%;" rowspan="1" colspan="1">已签约房间数</th>';
					var hoteldata = "";
					for(var k = 0; k < data.hotelSituation.length; k++) {
						data.hotelSituation[k].countryName = data.hotelSituation[k].countryName == null ? "" : data.hotelSituation[k].countryName;
						data.hotelSituation[k].hotelCount = data.hotelSituation[k].hotelCount == null ? "" : data.hotelSituation[k].hotelCount;
						data.hotelSituation[k].picCount = data.hotelSituation[k].picCount == null ? "" : data.hotelSituation[k].picCount;
						data.hotelSituation[k].networkSource = data.hotelSituation[k].networkSource == null ? "" : data.hotelSituation[k].networkSource;
						data.hotelSituation[k].signedHotelCount = data.hotelSituation[k].signedHotelCount == null ? "" : data.hotelSituation[k].signedHotelCount;
						data.hotelSituation[k].homeCount = data.hotelSituation[k].homeCount == null ? "" : data.hotelSituation[k].homeCount;
						data.hotelSituation[k].signedHomeCount = data.hotelSituation[k].signedHomeCount == null ? "" : data.hotelSituation[k].signedHomeCount;

						hoteldata += '<tr class="gradeA odd"><td style="text-align: center">' + data.hotelSituation[k].countryName + '</td>';
						hoteldata += '<td style="text-align: center">' + data.hotelSituation[k].hotelCount + '</td>';
						hoteldata += '<td style="text-align: center">' + data.hotelSituation[k].picCount + '</td>';
						hoteldata += '<td style="text-align: center">' + data.hotelSituation[k].networkSource + '</td>';
						hoteldata += '<td style="text-align: center">' + data.hotelSituation[k].signedHotelCount + '</td>';
						hoteldata += '<td style="text-align: center">' + data.hotelSituation[k].homeCount + '</td>';
						hoteldata += '<td style="text-align: center">' + data.hotelSituation[k].signedHomeCount + '</td>';
						hoteldata += '</tr>';
					}
					$("#hoteltitle").html(hoteltitle);
					$("#hotellist").html(hoteldata);
					//店铺新增
					var shoptitle = "";
					shoptitle += '<th tabindex="0" class="sorting" aria-controls="dataTables-example" style="text-align: center;width: 5%;" rowspan="1" colspan="1">区县</th>';
					shoptitle += '<th tabindex="0" class="sorting" aria-controls="dataTables-example" style="text-align: center;width: 5%;" rowspan="1" colspan="1">新增商铺数</th>';
					shoptitle += '<th tabindex="0" class="sorting" aria-controls="dataTables-example" style="text-align: center;width: 5%;" rowspan="1" colspan="1">拜访数</th>';
					shoptitle += '<th tabindex="0" class="sorting" aria-controls="dataTables-example" style="text-align: center;width: 5%;" rowspan="1" colspan="1">签约数</th>';
					var shopdata = "";
					for(var k = 0; k < data.shopSituation.length; k++) {
						data.shopSituation[k].countryName = data.shopSituation[k].countryName == null ? "" : data.shopSituation[k].countryName;
						data.shopSituation[k].shopCount = data.shopSituation[k].shopCount == null ? "" : data.shopSituation[k].shopCount;
						data.shopSituation[k].visited = data.shopSituation[k].visited == null ? "" : data.shopSituation[k].visited;
						data.shopSituation[k].signed = data.shopSituation[k].signed == null ? "" : data.shopSituation[k].signed;
						shopdata += '<tr class="gradeA odd"><td style="text-align: center">' + data.shopSituation[k].countryName + '</td>';
						shopdata += '<td style="text-align: center">' + data.shopSituation[k].shopCount + '</td>';
						shopdata += '<td style="text-align: center">' + data.shopSituation[k].visited + '</td>';
						shopdata += '<td style="text-align: center">' + data.shopSituation[k].signed + '</td>';
						shopdata += '</tr>';
					}
					$("#shoptitle").html(shoptitle);
					$("#shoplist").html(shopdata);
					// 楼宇市场拓展
					var buildtitle = "";
					buildtitle += '<th tabindex="0" class="sorting" aria-controls="dataTables-example" style="text-align: center;width: 5%;" rowspan="1" colspan="1">区县</th>';
					buildtitle += '<th tabindex="0" class="sorting" aria-controls="dataTables-example" style="text-align: center;width: 5%;" rowspan="1" colspan="1">楼宇数</th>';
					buildtitle += '<th tabindex="0" class="sorting" aria-controls="dataTables-example" style="text-align: center;width: 5%;" rowspan="1" colspan="1">商铺数</th>';
					buildtitle += '<th tabindex="0" class="sorting" aria-controls="dataTables-example" style="text-align: center;width: 5%;" rowspan="1" colspan="1">资源已覆盖楼宇数</th>';
					buildtitle += '<th tabindex="0" class="sorting" aria-controls="dataTables-example" style="text-align: center;width: 5%;" rowspan="1" colspan="1">已签约楼宇数</th>';
					var builddata = "";
					for(var k = 0; k < data.buildingSituation.length; k++) {
						data.buildingSituation[k].countryName = data.buildingSituation[k].countryName == null ? "" : data.buildingSituation[k].countryName;
						data.buildingSituation[k].buildingCount = data.buildingSituation[k].buildingCount == null ? "" : data.buildingSituation[k].buildingCount;
						data.buildingSituation[k].shopcount = data.buildingSituation[k].shopcount == null ? "" : data.buildingSituation[k].shopcount;
						data.buildingSituation[k].networkSource = data.buildingSituation[k].networkSource == null ? "" : data.buildingSituation[k].networkSource;
						data.buildingSituation[k].signed = data.buildingSituation[k].signed == null ? "" : data.buildingSituation[k].signed;
						builddata += '<tr class="gradeA odd"><td style="text-align: center">' + data.buildingSituation[k].countryName + '</td>';
						builddata += '<td style="text-align: center">' + data.buildingSituation[k].buildingCount + '</td>';
						builddata += '<td style="text-align: center">' + data.buildingSituation[k].shopcount + '</td>';
						builddata += '<td style="text-align: center">' + data.buildingSituation[k].networkSource + '</td>';
						builddata += '<td style="text-align: center">' + data.buildingSituation[k].signed + '</td>';
						builddata += '</tr>';
					}
					$("#buildtitle").html(buildtitle);
					$("#buildlist").html(builddata);
					// 商客经理
					var managertitle = "";
					managertitle += '<th tabindex="0" class="sorting" aria-controls="dataTables-example" style="text-align: center;width: 5%;" rowspan="1" colspan="1">城市</th>';
					managertitle += '<th tabindex="0" class="sorting" aria-controls="dataTables-example" style="text-align: center;width: 5%;" rowspan="1" colspan="1">区县</th>';
					managertitle += '<th tabindex="0" class="sorting" aria-controls="dataTables-example" style="text-align: center;width: 5%;" rowspan="1" colspan="1">商客经理</th>';
					managertitle += '<th tabindex="0" class="sorting" aria-controls="dataTables-example" style="text-align: center;width: 5%;" rowspan="1" colspan="1">上传店铺数</th>';
					managertitle += '<th tabindex="0" class="sorting" aria-controls="dataTables-example" style="text-align: center;width: 5%;" rowspan="1" colspan="1">最后登录时间</th>';
					var managerdata = "";
					for(var k = 0; k < data.userUseageDetail.length; k++) {
						data.userUseageDetail[k].cityName = data.userUseageDetail[k].cityName == null ? "" : data.userUseageDetail[k].cityName;
						data.userUseageDetail[k].countryName = data.userUseageDetail[k].countryName == null ? "" : data.userUseageDetail[k].countryName;
						data.userUseageDetail[k].realName = data.userUseageDetail[k].realName == null ? "" : data.userUseageDetail[k].realName;
						data.userUseageDetail[k].uploadShopCount = data.userUseageDetail[k].uploadShopCount == null ? "" : data.userUseageDetail[k].uploadShopCount;
						data.userUseageDetail[k].lastUse = data.userUseageDetail[k].lastUse == null ? "" : data.userUseageDetail[k].lastUse;
						managerdata += '<tr class="gradeA odd"><td style="text-align: center">' + data.userUseageDetail[k].cityName + '</td>';
						managerdata += '<td style="text-align: center">' + data.userUseageDetail[k].countryName + '</td>';
						managerdata += '<td style="text-align: center">' + data.userUseageDetail[k].realName + '</td>';
						managerdata += '<td style="text-align: center">' + data.userUseageDetail[k].uploadShopCount + '</td>';
						managerdata += '<td style="text-align: center">' + data.userUseageDetail[k].lastUse + '</td>';
						managerdata += '</tr>';
					}
					$("#managertitle").html(managertitle);
					$("#managerlist").html(managerdata);
				} else {
					var msg = datas.msg == null ? "" : datas.msg;
					AlertInfo("请求失败！" + msg);
				}
			}
		})
	}

	function Search() {
		setTable();
	}
</script>